<script src="<?php echo $url_styles ?>js/plugins/formselements/jquery.maskedinput-1.3.min.js"></script>
<script src="<?php echo $url_styles ?>js/plugins/formselements/ui.spinner.min.js"></script>
<script>

//	$('.form-horizontal [name="price"]').spinner({ min: 0,numberFormat: 'n',step: 0.01});
//	$('.form-horizontal [name="sale_price"]').spinner({ min: 0,numberFormat: 'n'});
	$('.form-horizontal [name="start"]').datepicker();
	$('.form-horizontal [name="end"]').datepicker();
	$('.form-horizontal [name="start"]').datepicker('option','dateFormat','dd/mm/yy');
	$('.form-horizontal [name="end"]').datepicker('option','dateFormat','dd/mm/yy');
    var image_index=0;
	$('#add_image').live('click',function(){
        image_index++;
		$('#images').append('<div><input type="file" name="images_'+image_index+'" class="input-xlarges"/>\n\
							<a href="javascript:;" class="delete_image"><?php echo lang('delete')?></a></div>');
		return false;
	});
	$('.delete_image').live('click',function(){
		$(this).parent().fadeOut('fast',function(){$(this).remove()});
	});
	$('#tab4_check').click(function(){
		$('.form-horizontal [name="catalogues[]"]').attr('checked',this.checked);
	})
	$('#tab5_check').click(function(){
        $('.form-horizontal [name="locations[]"]').attr('checked',this.checked);
	})
    $('#tab4_check').click(function(){
        $('.form-horizontal [name="catalogues[]"]').attr('checked',this.checked);
    })
    $('#tab5_check').click(function(){
        $('.form-horizontal [name="locations[]"]').attr('checked',this.checked);
    })

    var error = jQuery.parseJSON('<?php echo $error?>');
    for(var i in error)
    {
        if(i=='id' || i=='catalogues' || i=='locations')
        {

        }
        else if(error[i]!=''){
            $('.form-horizontal [name="'+i+'"]').after('<span class="help-inline">'+error[i]+'</span>');
            $('.form-horizontal [name="'+i+'"]').parent().parent().addClass('error');
        }

    }
</script>
